package Servlet;

import Bean.Page;
import Service.AuditService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 张
 * Date: 2025-03-13
 * Time: 17:35
 */
//查看用户改签的机票信息
@WebServlet("/ChangeTicketListServlet")
public class ChangeTicketListServlet extends HttpServlet {
    private AuditService auditService = new AuditService();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("UTF-8");
        resp.setContentType("application/json;charset=utf8");
        int pageNo = Integer.parseInt(req.getParameter("pageNo"));
        int pageSize = 5;
        String userId = (String) req.getSession().getAttribute("LoginUserId");
        Page page = auditService.selectByUserId(pageNo,pageSize,userId);
        req.setAttribute("list",page.getList());
        req.setAttribute("box",page);
        req.getRequestDispatcher("audit_list.jsp").forward(req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req,resp);
    }
}
